import { request,BASEURL} from '../../utils/request';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    teamList:[],
    index:1
  },
  onShow: function () {
          this.teamList()
          this.setData({
            show:true
          })
   },
  onLoad: function (options) {
  },
  //请求团队页面数据
  async teamList(){
      let {openid} = wx.getStorageSync('uid')
      let res = await request({
        url: '/api/Wxapp/myTeam',
        method:"POST",
        data:{
          openid,
          type:this.data.index
        }
      })
      console.log(res.data.data)
      this.setData({
        teamList:res.data.data
      })
    },
// 切换
qiehuanBtn(e){
  console.log(e)
  let {index} = e.target.dataset
  this.setData({
    index
  })
  this.teamList()
},
// 跳转
look(e){
  console.log(e)
  let {uid} = e.currentTarget.dataset
  wx.navigateTo({
    url: '/pages/look/look?uid='+uid,
  })
},


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let {openid} = wx.getStorageSync('uid')
    return {
      title: "邀请好友",
      path:`/pages/index/index?pid=${openid}` 
    }
  }
})